home *** CD-ROM | disk | FTP | other *** search
- Subject: Polygon shapes
- Sent: 7/23/96 12:09 PM
- Received: 7/23/96 12:20 PM
- From: Brian Arnold, arnold@lumina.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- Howdy ODF-ers,
-
- Since my ODF Draw-derived part needed polygon shapes, I patched together a
- polygon shape class and a hexagon shape subclass for testing. I'm not
- proud of it, but it works well enough for a demo. Send me e-mail if you
- want the sources (there isn't much source, mostly headers ;-). Feel free
- to provide feedback (before I go off defining more subclasses for my
- part...).
-
- Here are some notes I kept while writing it. It took about a day to write,
- graft into my Draw (er, Sketch) part, and test.
-
- o) I would pummel the person who decided OpenDoc will use fixed point
- numbers. The reason is, you can't "just use them" with literals. I took a
- six-of-one approach, coercing FW_IntToFixed on my literals, then noted ODF
- sometimes takes a half-a-dozen-of-the-other approach, converting FW_Fixeds
- into ints, doing math with literals, then converting back to FW_Fixeds.
- "Sheesh" is all I can say.
-
- o) There is incomplete support for polygons in ODF 1; here's a key function
- I identified as missing (included as a static fn in my PolyShp.cpp file):
-
- //--------------------------------
- // FW_CreatePolygonODShape
- // !!! Missing from FWGrUtil.cpp
- //--------------------------------
-
- static ODShape* FW_CreatePolygonODShape(
- Environment *ev,
- unsigned long pointCount,
- const FW_SPoint* pointArray)
- {
- ODShape* shape = ::FW_NewODShape(ev);
- ::FW_SetShapeRegion(ev, shape, ::FW_CreatePolygonRegion(pointCount,
- pointArray));
- return shape;
- }
-
- o) The private ODF representation for a Polygon effectively requires that
- its points fCount be initialized once and not changed. It would be more
- convenient if SetPoints() could adjust the fCount and adjust the memory
- pointed to by fPoints instead of throwing an assertion when SetPoints sets
- more points than fCount.
-
- o) Although the ODF Polygon shape renderer has an autoCloseFrame parameter,
- when I drag my polygon shapes without a closed polygon (the OD polygon
- shape I assume), they are are outlined screwy. I had to make sure my
- Hexagon shape subclass includes the first point as the last point even
- though the parent class Polygon shape uses autoCloseFrame as true and draws
- correctly without the last point. Did I misunderstand this parameter's
- purpose, or is there a defect/limitation in the OpenDoc polygon
- representation?
-
- o) I had initially copied the OvalShp sources as a template for developing
- the PolyShp and HexShp sources, and I noticed these very simple shapes
- files pull in a lot of headers that don't appear to be needed. How much of
- this is necessary?
-
- o) There are ODF <blah-blah> shapes (derived from FW_TGrRefPtr), and ODF
- <blah-blah>Shape shapes (derived from FW_CShape), the latter which look
- similar to the ODF Draw shape types. What is the relationship between all
- of these? Should ODF Draw (and hence my code as well) eventually be using
- the FW_CShapes instead of defining its own parallel representations?
-
- o) Finally, a thank-you to those who worked on shapes in ODF and ODF Draw:
- I found them generally easier to work with and much more powerful than the
- MacApp shape code in my existing app, despite the very minor issues listed
- above.
-
- - Brian
-
- ---------------------------------------------------------------
- Brian Arnold arnold@lumina.com
- Director of Software Development
- Lumina Decision Systems, Inc. http://www.lumina.com/
-
-
-